import 'package:logger/logger.dart';

class Log {
  static bool _debug = false;
  static Level _level = Level.warning;

  // 设置是否为调试模式
  static set debug(bool enableDebug) {
    _debug = enableDebug;
    if(_debug) {
      level = Level.debug;
    }

    Logger.level = _level;
  }

  // 设置日志等级
  static set level(Level? val) {
    if(val == null) {
      _level = Level.warning;
    } else {
      _level = val;
    }
  }

  static Logger getLogger(String name) {
    return Logger(level: _level);
  }
}